// VBConversions Note: VB project level imports
using System.Collections.Generic;
using System;
using System.Linq;
using System.Drawing;
using System.Diagnostics;
using Microsoft.VisualBasic;
using System.Xml.Linq;
using Microsoft.VisualBasic.Compatibility;
using System.Windows.Forms;
using System.Collections;
using System.Data;
// End of VB project level imports

using System.Drawing.Drawing2D;

namespace 喷码数据生成工具
{
	public class gdToolStrip : System.Windows.Forms.ToolStripRenderer
	{
		public gdToolStrip()
		{
			// VBConversions Note: Non-static class variable initialization is below.  Class variables cannot be initially assigned non-static values in C#.
			mButtonHoverBorderColor = Color.FromArgb(255, 128, 192);
			mButtonHoverColor1 = Color.FromArgb(255, 236, 255);
			mButtonHoverColor2 = Color.FromArgb(255, 161, 255);
			mButtonDownBorderColor = Color.FromArgb(128, 0, 128);
			mButtondownColor1 = Color.FromArgb(255, 0, 255);
			mButtondownColor2 = Color.FromArgb(255, 192, 255);
			mToolBorderColor = Color.FromArgb(255, 128, 192);
			mToolBackColor1 = Color.White;
			mToolBackColor2 = Color.FromArgb(255, 192, 255);
			mToolBackColor3 = Color.FromArgb(255, 128, 255);
			mToolBackColor4 = Color.FromArgb(255, 192, 255);
			mToolBackColor5 = Color.FromArgb(250, 252, 247);
			mSplitColor = Color.FromArgb(255, 128, 192);
			mGripColor = Color.FromArgb(128, 0, 128);
			mToolMenuItemBackColor = Color.White;
			mToolMenuItemHoverColor1 = Color.White;
			mToolMenuItemHoverColor2 = Color.FromArgb(255, 192, 255);
			mToolMenuItemHoverColor3 = Color.FromArgb(255, 128, 255);
			mToolMenuItemHoverColor4 = Color.FromArgb(255, 192, 255);
			mToolMenuItemHoverColor5 = Color.FromArgb(250, 252, 247);
			mMenuLeftBackColor = Color.FromArgb(150, 255, 128, 255);
			
		}
		private Color mButtonHoverBorderColor; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mButtonHoverColor1; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mButtonHoverColor2; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mButtonDownBorderColor; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mButtondownColor1; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mButtondownColor2; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mToolBorderColor; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mToolBackColor1; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mToolBackColor2; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mToolBackColor3; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mToolBackColor4; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mToolBackColor5; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mSplitColor; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mGripColor; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mToolMenuItemBackColor; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mToolMenuItemHoverColor1; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mToolMenuItemHoverColor2; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mToolMenuItemHoverColor3; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mToolMenuItemHoverColor4; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mToolMenuItemHoverColor5; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		private Color mMenuLeftBackColor; // VBConversions Note: Initial value cannot be assigned here since it is non-static.  Assignment has been moved to the class constructors.
		
		bool DownEvent = false;
#region 自定义属性
public Color MenuLeftBackColor
		{
			get
			{
				return mMenuLeftBackColor;
			}
			set
			{
				mMenuLeftBackColor = value;
			}
		}
public Color ToolMenuItemHoverColor5
		{
			get
			{
				return mToolMenuItemHoverColor5;
			}
			set
			{
				mToolMenuItemHoverColor5 = value;
			}
		}
public Color ToolMenuItemHoverColor4
		{
			get
			{
				return mToolMenuItemHoverColor4;
			}
			set
			{
				mToolMenuItemHoverColor4 = value;
			}
		}
public Color ToolMenuItemHoverColor3
		{
			get
			{
				return mToolMenuItemHoverColor3;
			}
			set
			{
				mToolMenuItemHoverColor3 = value;
			}
		}
public Color ToolMenuItemHoverColor2
		{
			get
			{
				return mToolMenuItemHoverColor2;
			}
			set
			{
				mToolMenuItemHoverColor2 = value;
			}
		}
public Color ToolMenuItemHoverColor1
		{
			get
			{
				return mToolMenuItemHoverColor1;
			}
			set
			{
				mToolMenuItemHoverColor1 = value;
			}
		}
public Color ToolMenuItemBackColor
		{
			get
			{
				return mToolMenuItemBackColor;
			}
			set
			{
				mToolMenuItemBackColor = value;
			}
		}
public Color GripColor
		{
			get
			{
				return mGripColor;
			}
			set
			{
				mGripColor = value;
			}
		}
public Color SplitColor
		{
			get
			{
				return mSplitColor;
			}
			set
			{
				mSplitColor = value;
			}
		}
public Color ToolBackColor5
		{
			get
			{
				return mToolBackColor5;
			}
			set
			{
				mToolBackColor5 = value;
			}
		}
public Color ToolBackColor4
		{
			get
			{
				return mToolBackColor4;
			}
			set
			{
				mToolBackColor4 = value;
			}
		}
public Color ToolBackColor3
		{
			get
			{
				return mToolBackColor3;
			}
			set
			{
				mToolBackColor3 = value;
			}
		}
public Color ToolBackColor2
		{
			get
			{
				return mToolBackColor2;
			}
			set
			{
				mToolBackColor2 = value;
			}
		}
public Color ToolBackColor1
		{
			get
			{
				return mToolBackColor1;
			}
			set
			{
				mToolBackColor1 = value;
			}
		}
public Color ToolBorderColor
		{
			get
			{
				return mToolBorderColor;
			}
			set
			{
				mToolBorderColor = value;
			}
		}
public Color ButtondownColor2
		{
			get
			{
				return mButtondownColor2;
			}
			set
			{
				mButtondownColor2 = value;
			}
		}
public Color ButtondownColor1
		{
			get
			{
				return mButtondownColor1;
			}
			set
			{
				mButtondownColor1 = value;
			}
		}
public Color ButtonDownBorderColor
		{
			get
			{
				return mButtonDownBorderColor;
			}
			set
			{
				mButtonDownBorderColor = value;
			}
		}
public Color ButtonHoverColor2
		{
			get
			{
				return mButtonHoverColor2;
			}
			set
			{
				mButtonHoverColor2 = value;
			}
		}
public Color ButtonHoverColor1
		{
			get
			{
				return mButtonHoverColor1;
			}
			set
			{
				mButtonHoverColor1 = value;
			}
		}
public Color ButtonHoverBorderColor
		{
			get
			{
				return mButtonHoverBorderColor;
			}
			set
			{
				mButtonHoverBorderColor = value;
			}
		}
#endregion
		protected override void OnRenderButtonBackground(System.Windows.Forms.ToolStripItemRenderEventArgs e)
		{
			ToolStrip ToolStrip = e.ToolStrip;
			ToolStripButton Item = (ToolStripButton) e.Item;
			Graphics g = e.Graphics;
			if (!(Item == null))
			{
				// ToolStrip .LayoutStyle=
				Rectangle Bounds = default(Rectangle);
				if (ToolStrip.Orientation == Orientation.Horizontal)
				{
					Bounds = new Rectangle(new Point(0, 1), new Size(Item.Width - 1, Item.Height - 2));
				}
				else
				{
					Bounds = new Rectangle(new Point(2, 0), new Size(Item.Width - 3, Item.Height - 1));
				}
				LinearGradientBrush Brush = new LinearGradientBrush(Bounds, mButtonHoverColor1, mButtonHoverColor2, LinearGradientMode.Vertical);
				if (Item.BackgroundImage != null)
				{
					g.FillRectangle(Brush, Bounds);
					g.DrawRectangle(new Pen(mButtonHoverBorderColor), Bounds);
				}
				if (Item.Selected & Item.CheckState == CheckState.Unchecked & Item.Pressed == false)
				{
					g.FillRectangle(Brush, Bounds);
					g.DrawRectangle(new Pen(mButtonHoverBorderColor), Bounds);
				}
				else if (Item.Selected && Item.Pressed)
				{
					Brush = new LinearGradientBrush(Bounds, mButtondownColor1, mButtondownColor2, LinearGradientMode.Vertical);
					g.FillRectangle(Brush, Bounds);
					g.DrawRectangle(new Pen(mButtonDownBorderColor), Bounds);
				}
				Brush.Dispose();
			}
			base.OnRenderButtonBackground(e);
		}
		protected override void OnRenderImageMargin(System.Windows.Forms.ToolStripRenderEventArgs e)
		{
			//e.Graphics.FillRectangle(New SolidBrush(mToolBorderColor), e.AffectedBounds)
			base.OnRenderImageMargin(e);
		}
		
		private void gdToolStrip_RenderDropDownButtonBackground(object sender, System.Windows.Forms.ToolStripItemRenderEventArgs e)
		{
			ToolStrip ToolStrip = e.ToolStrip;
			ToolStripItem Item = e.Item;
			Graphics g = e.Graphics;
			if (!(Item == null))
			{
				// ToolStrip .LayoutStyle=
				Rectangle Bounds = default(Rectangle);
				if (ToolStrip.Orientation == Orientation.Horizontal)
				{
					Bounds = new Rectangle(new Point(0, 1), new Size(Item.Width - 1, Item.Height - 2));
				}
				else
				{
					Bounds = new Rectangle(new Point(2, 0), new Size(Item.Width - 3, Item.Height - 1));
				}
				LinearGradientBrush Brush = new LinearGradientBrush(Bounds, mButtonHoverColor1, mButtonHoverColor2, LinearGradientMode.Vertical);
				if (Item.BackgroundImage != null)
				{
					//  g.FillRectangle(Brush, Bounds)
					g.DrawRectangle(new Pen(mButtonHoverBorderColor), Bounds);
				}
				if (Item.Selected)
				{
					g.FillRectangle(Brush, Bounds);
					g.DrawRectangle(new Pen(mButtonHoverBorderColor), Bounds);
				}
				else if (Item.Pressed)
				{
					// MsgBox("down")
					Brush = new LinearGradientBrush(Bounds, mButtondownColor1, mButtondownColor2, LinearGradientMode.Vertical);
					g.FillRectangle(Brush, Bounds);
					g.DrawRectangle(new Pen(mButtonDownBorderColor), Bounds);
				}
				Brush.Dispose();
			}
		}
		
		private void gdToolStrip_RenderGrip(object sender, System.Windows.Forms.ToolStripGripRenderEventArgs e)
		{
			if (e.GripStyle == ToolStripGripStyle.Hidden)
			{
				return ;
			}
			Graphics g = e.Graphics;
			ToolStripGripDisplayStyle GripStyle = e.GripDisplayStyle;
			Rectangle Bounds = e.GripBounds;
			int Count = 0;
			int PointWidth = (int) (Bounds.Width / 2);
			Rectangle TmpRect = default(Rectangle);
			SolidBrush dBrush = new SolidBrush(mGripColor);
			if (GripStyle == ToolStripGripDisplayStyle.Horizontal)
			{
				PointWidth = (int) (Bounds.Height / 2);
				Count = (int) (Bounds.Width / PointWidth);
				for (var i = 0; i <= Count - 1; i++)
				{
					if (i % 2 != 0)
					{
						TmpRect = new Rectangle(i * PointWidth, (int) Bounds.Top, PointWidth, PointWidth);
						g.FillRectangle(dBrush, TmpRect);
					}
				}
			}
			else
			{
				PointWidth = (int) (Bounds.Width / 2);
				Count = (int) (Bounds.Height / PointWidth);
				for (var i = 0; i <= Count - 1; i++)
				{
					if (i % 2 != 0)
					{
						TmpRect = new Rectangle((int) Bounds.Left, i * PointWidth, PointWidth, PointWidth);
						g.FillRectangle(dBrush, TmpRect);
					}
				}
			}
		}
		
		private void gdToolStrip_RenderLabelBackground(object sender, System.Windows.Forms.ToolStripItemRenderEventArgs e)
		{
			// e.Graphics.FillRectangle(New SolidBrush(Color.Blue), New Rectangle(0, 0, e.Item.Width, e.Item.Height))
			ToolStrip ToolStrip = e.ToolStrip;
			ToolStripItem Item = e.Item;
			Graphics g = e.Graphics;
			if (!(Item == null))
			{
				// ToolStrip .LayoutStyle=
				
				Rectangle Bounds = default(Rectangle);
				if (ToolStrip.Orientation == Orientation.Horizontal)
				{
					Bounds = new Rectangle(new Point(0, 1), new Size(Item.Width - 1, Item.Height - 2));
				}
				else
				{
					Bounds = new Rectangle(new Point(2, 0), new Size(Item.Width - 3, Item.Height - 1));
				}
				LinearGradientBrush Brush = new LinearGradientBrush(Bounds, mButtonHoverColor1, mButtonHoverColor2, LinearGradientMode.Vertical);
				if (Item.BackgroundImage != null)
				{
					g.FillRectangle(Brush, Bounds);
					g.DrawRectangle(new Pen(mButtonHoverBorderColor), Bounds);
				}
				if (Item.Pressed == true)
				{
					
					Brush = new LinearGradientBrush(Bounds, mButtondownColor1, mButtondownColor2, LinearGradientMode.Vertical);
					g.FillRectangle(Brush, Bounds);
					g.DrawRectangle(new Pen(mButtonDownBorderColor), Bounds);
				}
				else if (Item.Selected)
				{
					g.FillRectangle(Brush, Bounds);
					g.DrawRectangle(new Pen(mButtonHoverBorderColor), Bounds);
				}
				Brush.Dispose();
			}
		}
		
		private void gdToolStrip_RenderMenuItemBackground(object sender, System.Windows.Forms.ToolStripItemRenderEventArgs e)
		{
			Graphics g = e.Graphics;
			ToolStripItem Item = e.Item;
			Rectangle LeftRect = new Rectangle(1, 0, 35, Item.Height);
			if (Item.Selected == false)
			{
				g.FillRectangle(new SolidBrush(mToolMenuItemBackColor), new Rectangle(0, 0, Item.Width, Item.Height));
				g.FillRectangle(new SolidBrush(mMenuLeftBackColor), LeftRect);
			}
			else
			{
				ColorBlend ColorB = new ColorBlend();
				Rectangle Bounds = new Rectangle(new Point(1, 0), new Size(Item.Width - 2, Item.Height - 1));
				LinearGradientBrush Dbrush = new LinearGradientBrush(Bounds, mToolMenuItemHoverColor1, mToolMenuItemHoverColor2, LinearGradientMode.Vertical);
				
				ColorB.Colors = new Color[] {mToolMenuItemHoverColor1, mToolMenuItemHoverColor2, mToolMenuItemHoverColor3, mToolMenuItemHoverColor4, mToolMenuItemHoverColor5};
				ColorB.Positions = new Single[] {0 / 4.0F, 1 / 4.0F, 2 / 4.0F, 3 / 4.0F, 4 / 4.0F};
				Dbrush.InterpolationColors = ColorB;
				g.FillRectangle(new SolidBrush(mMenuLeftBackColor), LeftRect);
				g.FillRectangle(Dbrush, Bounds);
				g.DrawRectangle(new Pen(mButtonHoverBorderColor), Bounds);
			}
		}
		
		private void gdToolStrip_RenderOverflowButtonBackground(object sender, System.Windows.Forms.ToolStripItemRenderEventArgs e)
		{
			ToolStripItem Item = e.Item;
			Graphics g = e.Graphics;
			Rectangle Bounds = new Rectangle(new Point(0, 1), new Size(Item.Width - 2, Item.Height - 2));
			LinearGradientBrush Dbrush = default(LinearGradientBrush);
			if (e.ToolStrip.Orientation == Orientation.Horizontal)
			{
				Dbrush = new LinearGradientBrush(Bounds, mButtonHoverColor1, mButtonHoverColor2, LinearGradientMode.Vertical);
			}
			else
			{
				Dbrush = new LinearGradientBrush(Bounds, mButtonHoverColor1, mButtonHoverColor2, LinearGradientMode.Horizontal);
			}
			
			if (Item.Selected == true && Item.Pressed == false)
			{
				g.FillRectangle(Dbrush, Bounds);
				g.DrawRectangle(new Pen(mButtonHoverBorderColor), Bounds);
			}
			else if (Item.Selected && Item.Pressed)
			{
				if (e.ToolStrip.Orientation == Orientation.Horizontal)
				{
					Dbrush = new LinearGradientBrush(Bounds, mButtondownColor1, mButtondownColor2, LinearGradientMode.Vertical);
				}
				else
				{
					Dbrush = new LinearGradientBrush(Bounds, mButtondownColor1, mButtondownColor2, LinearGradientMode.Horizontal);
				}
				g.FillRectangle(Dbrush, Bounds);
				g.DrawRectangle(new Pen(mButtonDownBorderColor), Bounds);
			}
			g.DrawLine(new Pen(Color.Black), (int) (Bounds.Left + 4), Convert.ToInt32(Bounds.Height / 2) - 1, (int) (Bounds.Width - 4), Convert.ToInt32(Bounds.Height / 2) - 1);
			DrawDownLogo(g, new Rectangle((int) Bounds.Left, (int) (Bounds.Top + Bounds.Height / 2), (int) Bounds.Width, (int) (Bounds.Height / 2)));
		}
		
		private void gdToolStrip_RenderSeparator(object sender, System.Windows.Forms.ToolStripSeparatorRenderEventArgs e)
		{
			Graphics g = e.Graphics;
			Rectangle DrawRect = new Rectangle(Point.Empty, new Size(e.Item.Width + 1, e.Item.Height));
			if (e.ToolStrip.IsDropDown)
			{
				DrawRect = new Rectangle(0, 0, e.Item.Width, e.Item.Height);
				// g.FillRectangle(New SolidBrush(mToolMenuItemBackColor), New Rectangle(1, 0, e.Item.Width, e.Item.Height))
				g.DrawLine(new Pen(mSplitColor), 35, 0, DrawRect.Right - 2, 0);
				
			}
			else
			{
				if (e.ToolStrip.Orientation == Orientation.Vertical)
				{
					g.DrawLine(new Pen(mSplitColor), new Point(4, (int) (DrawRect.Top + DrawRect.Height / 2)), new Point(e.Item.Width - 4, (int) (DrawRect.Top + DrawRect.Height / 2)));
				}
				else
				{
					g.DrawLine(new Pen(mSplitColor), new Point(DrawRect.Left + (double) DrawRect.Width / 2, 4), new Point((int) (DrawRect.Left + (double) DrawRect.Width / 2), (int) (DrawRect.Height - 4)));
				}
			}
		}
		
		private void gdToolStrip_RenderSplitButtonBackground(object sender, System.Windows.Forms.ToolStripItemRenderEventArgs e)
		{
			Graphics g = e.Graphics;
			ToolStrip ToolStrip = e.ToolStrip;
			ToolStripSplitButton Item = (ToolStripSplitButton) e.Item;
			if (Item != null)
			{
				LinearGradientBrush DrawBrush = default(LinearGradientBrush);
				int mWidth = 0;
				Rectangle Bounds = new Rectangle();
				if (ToolStrip.Orientation == Orientation.Horizontal)
				{
					Bounds = new Rectangle(0, 1, e.Item.Width - 1, e.Item.Height - 2);
					mWidth = 10;
				}
				else if (ToolStrip.Orientation == Orientation.Vertical)
				{
					Bounds = new Rectangle(2, 0, e.Item.Width - 3, e.Item.Height - 1);
					mWidth = 14;
				}
				Rectangle MRect = new Rectangle(Bounds.Right - mWidth, Bounds.Top, mWidth, Bounds.Height);
				g.SmoothingMode = SmoothingMode.HighQuality;
				if ((Item.BackgroundImage != null) && Item.ButtonSelected == false && Item.Pressed == false)
				{
					DrawBackGroundImage(g, (System.Drawing.Bitmap) Item.BackgroundImage, Item.BackgroundImageLayout, Bounds);
					DrawDownLogo(g, MRect);
				}
				else if (Item.BackgroundImage == null && Item.ButtonPressed == false && Item.Pressed == false && Item.Selected == false)
				{
					DrawDownLogo(g, MRect);
				}
				else if (Item.Selected && Item.ButtonPressed == false)
				{
					DrawBrush = new LinearGradientBrush(Bounds, mButtonHoverColor1, mButtonHoverColor2, LinearGradientMode.Vertical);
					g.FillRectangle(DrawBrush, Bounds);
					g.DrawRectangle(new Pen(mButtonHoverBorderColor), Bounds);
					g.DrawLine(new Pen(mButtonHoverBorderColor), MRect.Left, MRect.Top, MRect.Left, MRect.Bottom);
					DrawDownLogo(g, MRect);
				}
				else if (Item.ButtonPressed == true)
				{
					DrawBrush = new LinearGradientBrush(Bounds, mButtondownColor1, mButtondownColor2, LinearGradientMode.Vertical);
					LinearGradientBrush MBrush = new LinearGradientBrush(Bounds, mButtonHoverColor1, mButtonHoverColor2, LinearGradientMode.Vertical);
					g.FillRectangle(MBrush, MRect);
					g.DrawRectangle(new Pen(mButtonHoverBorderColor), MRect);
					g.FillRectangle(DrawBrush, new Rectangle(Bounds.Location, new Size(Bounds.Width - mWidth, Bounds.Height)));
					g.DrawRectangle(new Pen(mButtonDownBorderColor), new Rectangle(Bounds.Location, new Size(Bounds.Width - mWidth, Bounds.Height)));
					DrawDownLogo(g, MRect);
				}
				else if (Item.Pressed)
				{
					DrawBrush = new LinearGradientBrush(Bounds, mButtondownColor1, mButtondownColor2, LinearGradientMode.Vertical);
					LinearGradientBrush MBrush = new LinearGradientBrush(Bounds, mButtonHoverColor1, mButtonHoverColor2, LinearGradientMode.Vertical);
					g.FillRectangle(DrawBrush, MRect);
					g.DrawRectangle(new Pen(mButtonDownBorderColor), MRect);
					g.FillRectangle(MBrush, new Rectangle(Bounds.Location, new Size(Bounds.Width - mWidth, Bounds.Height)));
					g.DrawRectangle(new Pen(mButtonHoverBorderColor), new Rectangle(Bounds.Location, new Size(Bounds.Width - mWidth, Bounds.Height)));
					DrawDownLogo(g, MRect);
				}
			}
		}
		private void DrawDownLogo(Graphics g, Rectangle Bounds)
		{
			GraphicsPath LogoPath = new GraphicsPath(FillMode.Alternate);
			int R = 6;
			int Rh = (int) (Math.Sin(60.0F) * R);
			LogoPath.AddLine(new Point(Bounds.Left + Convert.ToInt32((double) (Bounds.Width - R) / 2), Bounds.Top + Convert.ToInt32((double) (Bounds.Height - R) / 2)), new Point(Bounds.Right - Convert.ToInt32((double) (Bounds.Width - R) / 2), Bounds.Top + Convert.ToInt32((double) (Bounds.Height - R) / 2)));
			LogoPath.AddLine(new Point(Bounds.Right - Convert.ToInt32((double) (Bounds.Width - R) / 2), Bounds.Top + Convert.ToInt32((double) (Bounds.Height - R) / 2)), new Point(Bounds.Left + (double) Bounds.Width / 2, Bounds.Bottom - Convert.ToInt32((double) (Bounds.Height - R) / 2) - 2));
			LogoPath.AddLine(new Point((int) (Bounds.Left + Bounds.Width / 2), Bounds.Bottom - Convert.ToInt32((double) (Bounds.Height - R) / 2) - 2), new Point(Bounds.Left + Convert.ToInt32((double) (Bounds.Width - R) / 2), Bounds.Top + Convert.ToInt32((double) (Bounds.Height - R) / 2)));
			g.FillPath(new SolidBrush(Color.Black), LogoPath);
			LogoPath.Dispose();
		}
		private void DrawBackGroundImage(Graphics g, Bitmap Img, ImageLayout LayOut, Rectangle Bounds)
		{
			switch (LayOut)
			{
				case ImageLayout.None:
					g.DrawImage(Img, 0, 0, Img.Width, Img.Height);
					break;
				case ImageLayout.Center:
					g.DrawImage(Img, Convert.ToInt32((Bounds.Width - Img.Width) / 2), Convert.ToInt32((Bounds.Height - Img.Height) / 2), Img.Width, Img.Height);
					break;
				case ImageLayout.Stretch:
					g.DrawImage(Img, Bounds, new Rectangle(0, 0, Img.Width, Img.Height), GraphicsUnit.Pixel);
					break;
				case ImageLayout.Tile:
					TextureBrush TextBrush = new TextureBrush(Img);
					g.FillRectangle(TextBrush, Bounds);
					break;
				case ImageLayout.Zoom:
					if (Img.Width <= Bounds.Width & Img.Height <= Bounds.Height)
					{
						int tmpWidth = 0;
						int tmpHeight = 0;
						if (Img.Width < Img.Height)
						{
							tmpHeight = (int) Bounds.Height;
							tmpWidth = (int) (Bounds.Width * (Bounds.Height / Img.Height));
						}
						else if (Img.Width > Img.Height)
						{
							tmpWidth = (int) Bounds.Width;
							tmpHeight = (int) (Bounds.Height * (Bounds.Width / Bounds.Width));
						}
						g.DrawImage(Img, new Rectangle(Convert.ToInt32((Bounds.Width - tmpWidth) / 2), Convert.ToInt32((Bounds.Height - tmpHeight) / 2), tmpWidth, tmpHeight), new Rectangle(0, 0, Img.Width, Img.Height), GraphicsUnit.Pixel);
					}
					else
					{
						g.DrawImage(Img, 0, 0, Img.Width, Img.Height);
					}
					break;
			}
		}
		private void gdToolStrip_RenderToolStripBackground(object sender, System.Windows.Forms.ToolStripRenderEventArgs e)
		{
			Rectangle Bounds = e.AffectedBounds;
			LinearGradientBrush DrawBrush = null;
			Graphics g = e.Graphics;
			ToolStrip ToolStrip = e.ToolStrip;
			ColorBlend ColorB = new ColorBlend();
			if (ToolStrip.IsDropDown == false)
			{
				if (ToolStrip.Orientation == Orientation.Horizontal)
				{
					DrawBrush = new LinearGradientBrush(Bounds, mToolBackColor1, mToolBackColor2, LinearGradientMode.Vertical);
				}
				else if (ToolStrip.Orientation == Orientation.Vertical)
				{
					DrawBrush = new LinearGradientBrush(Bounds, mToolBackColor1, mToolBackColor2, LinearGradientMode.Horizontal);
				}
				ColorB.Colors = new Color[] {mToolBackColor1, mToolBackColor2, mToolBackColor3, mToolBackColor4, mToolBackColor5};
				ColorB.Positions = new Single[] {0 / 4.0F, 1 / 4.0F, 2 / 4.0F, 3 / 4.0F, 4 / 4.0F};
				if (DrawBrush != null)
				{
					DrawBrush.InterpolationColors = ColorB;
					g.FillRectangle(DrawBrush, Bounds);
				}
			}
			else
			{
				
				g.FillRectangle(new SolidBrush(mToolMenuItemBackColor), Bounds);
				Rectangle LeftRect = new Rectangle(0, 0, 36, Bounds.Height);
				g.FillRectangle(new SolidBrush(mMenuLeftBackColor), LeftRect);
			}
			g.DrawRectangle(new Pen(mToolBorderColor), new Rectangle(Bounds.Location, new Size((int) (Bounds.Width - 1), (int) (Bounds.Height - 1))));
		}
		
		private void gdToolStrip_RenderToolStripBorder(object sender, System.Windows.Forms.ToolStripRenderEventArgs e)
		{
			Rectangle Border = e.AffectedBounds;
			e.Graphics.DrawRectangle(new Pen(mToolBorderColor), new Rectangle(Border.Location, new Size(Border.Width - 1, Border.Height - 1)));
			
		}
		
		private void gdToolStrip_RenderToolStripStatusLabelBackground(object sender, System.Windows.Forms.ToolStripItemRenderEventArgs e)
		{
			ToolStrip ToolStrip = e.ToolStrip;
			ToolStripButton Item = (ToolStripButton) e.Item;
			Graphics g = e.Graphics;
			if (!(Item == null))
			{
				// ToolStrip .LayoutStyle=
				Rectangle Bounds = default(Rectangle);
				if (ToolStrip.Orientation == Orientation.Horizontal)
				{
					Bounds = new Rectangle(new Point(0, 1), new Size(Item.Width - 1, Item.Height - 2));
				}
				else
				{
					Bounds = new Rectangle(new Point(2, 0), new Size(Item.Width - 3, Item.Height - 1));
				}
				LinearGradientBrush Brush = new LinearGradientBrush(Bounds, mButtonHoverColor1, mButtonHoverColor2, LinearGradientMode.Vertical);
				if (Item.BackgroundImage != null)
				{
					g.FillRectangle(Brush, Bounds);
					g.DrawRectangle(new Pen(mButtonHoverBorderColor), Bounds);
				}
				if (Item.Selected && Item.Selected && Item.Pressed == false)
				{
					g.FillRectangle(Brush, Bounds);
					g.DrawRectangle(new Pen(mButtonHoverBorderColor), Bounds);
				}
				else if (Item.Selected && Item.Pressed)
				{
					Brush = new LinearGradientBrush(Bounds, mButtondownColor1, mButtondownColor2, LinearGradientMode.Vertical);
					g.FillRectangle(Brush, Bounds);
					g.DrawRectangle(new Pen(mButtonDownBorderColor), Bounds);
				}
				Brush.Dispose();
			}
		}
	}
	
}
